
@extends('Admin.common.header')

<!-- 1.添加meta csrf_token -->
<meta name="csrf-token" content="{{ csrf_token() }}"> 
<br/><br/><br/><br/>

<!-- 页面标记 -->
<div style="float:left;margin-left:130px;">
	<mark style="font-size:18px;">{{ $title or '' }}</mark>
	
</div>
<br/><br/><br/>

<!-- 友情链接表格 -->
<div class="bs-example" data-example-id="hoverable-table" style="width:80%;margin:0 auto;">
    <table class="table table-hover">
		<thead>
			<tr>
				<th>网站名称</th>
				<th>链接地址</th>
				<th>操作</th>
				<th>
					<a href="{{ url('/friend/create') }}" style="font-size:18px;margin-left:130px;">
						新建
					</a>
				</th>
			</tr>
		</thead>
		<tbody>
			@foreach($links as $link_info)
				<tr>
					<th scope="row">{{ $link_info->name }}</th>
					<td>{{ $link_info->url }}</td>
					<td> 
						<a href="{{ asset('/friend/create') }}/{{ $link_info->id }}" >编辑</a>
						&nbsp; | &nbsp; 
						<a data-toggle="modal" onclick="delFri({{ $link_info->id }});">
							删除
						</a>
					</td>
				</tr>
			@endforeach
		</tbody>
    </table>
</div>

<script src=" {{ asset('./js/jquery-1.8.3.min.js') }} "></script>
<script>
	<!-- 2.设置全局ajax选项 -->
	$.ajaxSetup({
		headers: {
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	var _token = $('meta[name="csrf-token"]').attr('content');
	
	// 删除 友情链接
	function delFri( id ){

		$.ajax({
			type:"post",
			url:"{{ url('/friend/delete') }}"+'/'+id,
			data:{_token:_token},
			async:true,    						
			dataType:"json",
			success:function(back){
				$('#show_info').html( '' );
				$('#show_info').html( back['show_info'] );
				location.reload();

			}
		});
	}
	




	
</script>


@extends('Admin.common.footer')